package com.hengpeng.itfinbase.persist;

import java.text.DateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;

import com.hengpeng.common.persist.entity.AbstractAutoIdEntity;

/**
 * <pre>
 * 会员日志信息
 * </pre>
 * @author lijiadong
 * @version 1.0, 2010-8-30
 */
@Entity
public class UserInfoLog extends AbstractAutoIdEntity
{

	public static enum MemberActionType
	{
		/**
		 * 激活
		 */
		ACTIVE("激活"),
		/**
		 * 销户
		 */
		CLOSE("销户"),
		/**
		 * 登录
		 */
		LOGIN("登录"),
		/**
		 * 注册
		 */
		REGISTE("注册"),
		/**
		 * 修改资料
		 */
		UPDATE("修改资料");
		private String text;

		MemberActionType(String text)
		{
			this.text = text;
		}

		public String getText()
		{
			return text;
		}

	}

	private static final long serialVersionUID = -4103036437177649420L;

	/**
	 * 操作描述
	 */
	@Column(length = 1000)
	private String description;

	/**
	 * 被操作引响的其他对象id
	 */
	@Column(length = 50)
	private String entityId;

	/**
	 * 操作引响的其他对象名称
	 */
	@Column(length = 20)
	private String entityName;

	/**
	 * 会员操作时登录的ip
	 */
	@Column(length = 30)
	private String ip;

	/**
	 * 操作的类型（枚举型 见本类MemberActionType）
	 */
	@Enumerated(javax.persistence.EnumType.STRING)
	@Column(length = 20)
	private MemberActionType memberActionType;

	/**
	 * 操作的时间
	 */
	private Date operateTime;

	/**
	 * 会员编号
	 */
	@Column(length = 50)
	private String userId;

	public String getDescription()
	{
		return description;
	}

	public String getEntityId()
	{
		return entityId;
	}

	public String getEntityName()
	{
		return entityName;
	}

	public String getIp()
	{
		return ip;
	}

	public MemberActionType getMemberActionType()
	{
		return memberActionType;
	}

	public Date getOperateTime()
	{
		return operateTime;
	}

	public String getUserId()
	{
		return userId;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	public void setEntityId(String entityId)
	{
		this.entityId = entityId;
	}

	public void setEntityName(String entityName)
	{
		this.entityName = entityName;
	}

	public void setIp(String ip)
	{
		this.ip = ip;
	}

	public void setMemberActionType(MemberActionType memberActionType)
	{
		this.memberActionType = memberActionType;
	}

	public void setOperateTime(Date operateTime)
	{
		this.operateTime = operateTime;
	}

	public void setUserId(String userId)
	{
		this.userId = userId;
	}

	@Override
	public String toString()
	{
		return "History[" + DateFormat.getDateTimeInstance().format(operateTime) + ", " + memberActionType + ", "
				+ description + "]";
	}
}
